// 策略管理模块权限
const fotaSjcl = {
  'view': 'strategy:upgrade:view',
  'add': 'strategy:upgrade:add',
  'edit': 'strategy:upgrade:edit',
  'delete': 'strategy:upgrade:delete',
  // 创建测试
  'createTest': 'task:test:add',
  // 查看测试
  'viewTest': 'task:test:view',
  // 发布策略v// 策略管理模块权限
  'publish': 'strategy:upgrade:test:publish',
  // 停用策略
  'disabled': 'strategy:upgrade:stop',
  // 复制策略
  'copy': 'strategy:upgrade:copy'
}

const fotaTjcl = {
  'view': 'strategy:condition:view',
  'add': 'strategy:condition:add',
  'edit': 'strategy:condition:edit',
  'delete': 'strategy:condition:delete',
  // 停用策略
  'disabled': 'strategy:condition:stop',
  // 复制策略
  'copy': 'strategy:condition:copy'
}


function prepend(obj, prefix) {
  var res = {};
  for(var key in obj){
    res[key] = prefix + obj[key];
  }
  return res;
}
let all = {
  develop : {
    USER: {
      fotaSjcl : prepend(fotaSjcl, 'develop:'),
      fotaTjcl : prepend(fotaTjcl, 'develop:')
    },
  },
  channel : {
    USER: {
      fotaSjcl : prepend(fotaSjcl, 'channel:'),
      fotaTjcl : prepend(fotaTjcl, 'channel:')
    },
  },
  //同时提供大写key，方便相关类型为大写数据处校验权限
  uat : {
    USER: {
      fotaSjcl : prepend(fotaSjcl, 'uat:'),
      fotaTjcl : prepend(fotaTjcl, 'uat:')
    },
  },
}
export default all
